import random

def gen_unrepeat_random(max_num, n):
    #从0~max_num-1产出n个不重复的随机数
    temp_list = [i for i in range(max_num)]            
    for i in range(n):
        temp_list[i], temp_list[random.randint(0,max_num-1)] = temp_list[random.randint(0,max_num-1)], temp_list[i]
    temp_list[0:n].sort()
    return temp_list[0:n]
    